import ElementUI, { Footer, Input } from 'element-ui'
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../components/home/Home.vue'
import Welcome from '../pages/backend/Welcome'
import Users from '../pages/backend/Users.vue'
import Notices from '../pages/backend/Notices.vue'
import Device from '../pages/backend/Device.vue'
import Topic from '../pages/backend/Topic.vue'
import News from '../pages/backend/News.vue'
import Menus from '../pages/backend/Menus.vue'
import Messages from '../pages/backend/Messages.vue'
import Resource from '../pages/backend/Resource.vue'
import Category from '../pages/backend/Category.vue'
import Test2 from '../pages/backend/Test2.vue'
import Attachment from '../pages/backend/Attachment.vue'
import Hotnews from '../pages/backend/Hotnews.vue'


// 一级主页
import home_notice from '../components/homepage/Home/home_notice.vue'
import home_login from '../components/homepage/Home/home_login.vue'
import home_host from '../components/homepage/Home/home_host.vue'
import home_png from '../components/homepage/Home/home_png.vue'
import home_lab from '../components/homepage/Home/home_lab.vue'
import home_teachre from '../components/homepage/Home/home_teachre.vue'
import home_teachach from '../components/homepage/Home/home_teachach.vue'
import home_eais from '../components/homepage/Home/home_eais.vue'
import home_application from '../components/homepage/Home/home_application.vue'
import home_news from '../components/homepage/Home/home_news.vue'
import home_show from '../components/homepage/Home/home_show'
import home_plat from '../components/homepage/Home/home_plat.vue'

// 二级主页
import Hosthome from '../components/home/Hosthome.vue'
// import Homepage from '../components/homepage/Homepage.vue'
import Homenews from '../components/homepage/news/Homenews.vue'
import Centeroverview from '../components/homepage/overviews/Centeroverview.vue'
import teachingstaff from '../components/homepage/overviews/teachingstaff.vue'
import Allannouncements from '../components/homepage/news/Allannouncements.vue'
import Allannouncements_datail from '../components/homepage/news/Allannouncements_datail.vue'
import Laboratoryintroduction_detail from '../components/homepage/overviews/Laboratoryintroduction_detail.vue'
import Teachingachievements_detail from '../components/homepage/achievements/Teachingachievements_detail.vue'
import Studentachievement_detail from '../components/homepage/achievements/Studentachievement_detail.vue'
import Homenews_detail from '../components/homepage/news/Homenews_detail.vue'
import coursewareresources from '../components/homepage/resources/coursewareresources.vue'
import Softwareresources from '../components/homepage/resources/Softwareresources.vue'
import coursewareresources_detail from '../components/homepage/resources/coursewareresources_detail.vue'
import Softwareresources_detail from '../components/homepage/resources/Softwareresources_detail.vue'
import Laboratoryintroduction from '../components/homepage/overviews/Laboratoryintroduction.vue'
import Managementsystem from '../components/homepage/overviews/Managementsystem.vue'
import Teachingreform from '../components/homepage/achievements/Teachingreform.vue'
import Teachingachievements from '../components/homepage/achievements/Teachingachievements'
import Studentachievement from '../components/homepage/achievements/Studentachievement.vue'
import SQL from '../components/homepage/platforms/SQL.vue'
import PAT from '../components/homepage/platforms/PAT.vue'
import AOA from '../components/homepage/platforms/AOA.vue'
import Managedresource from '../components/homepage/applications/Managedresource.vue'
import FTP from '../components/homepage/applications/FTP.vue'
import applications from '../components/homepage/applications/applications.vue'
import Server from '../components/homepage/applications/Server.vue'
import TeachingOperationTable from '../components/homepage/tiis/TeachingOperationTable.vue'
import ExperimentalProjectCard from '../components/homepage/tiis/ExperimentalProjectCard.vue'
import FormDownload from '../components/homepage/services/FormDownload.vue'
import Coursescheduling from '../components/homepage/services/Coursescheduling.vue'
import DeviceManagement from '../components/homepage/services/DeviceManagement.vue'
import DeviceManagement_detail from '../components/homepage/services/DeviceManagement_detail.vue'

//后台管理
import bc_lab from '../pages/backend/bc_overviews/bc_lab.vue'
import bc_centerview from '../pages/backend/bc_overviews/bc_centerview.vue'
import bc_teastaff from '../pages/backend/bc_overviews/bc_teastaff.vue'
import bc_manage from '../pages/backend/bc_overviews/bc_manage.vue'

import bc_teareform from '../pages/backend/bc_achievements/bc_teareform.vue'
import bc_teaach from '../pages/backend/bc_achievements/bc_teaach.vue'
import bc_stuach from '../pages/backend/bc_achievements/bc_stuach.vue'

import bc_cources from '../pages/backend/bc_resources/bc_cources.vue'
import bc_soft from '../pages/backend/bc_resources/bc_soft.vue'

import apply_resources_add from '../pages/backend/apply_resources/apply_resources_add.vue'
import apply_resources_edit from '../pages/backend/apply_resources/apply_resources_edit.vue'
import apply_resources_detail from '../pages/backend/apply_resources/apply_resources_detail.vue'

import apply_EPcard_detail from '../pages/backend/apply_EPcard/apply_EPcard_detail.vue'
import apply_teachStatistics_detail from '../pages/backend/apply_teachStatistics/apply_teachStatistics_detail.vue'


import approval_resources_pass from '../pages/backend/approval_resources/approval_resources_pass.vue'
import approval_resources_reject from '../pages/backend/approval_resources/approval_resources_reject.vue'
import approval_resources_wait from '../pages/backend/approval_resources/approval_resources_wait.vue'

import approval_EPcard_pass from '../pages/backend/approval_EPcard/approval_EPcard_pass.vue'
import approval_EPcard_reject from '../pages/backend/approval_EPcard/approval_EPcard_reject.vue'
import approval_EPcard_wait from '../pages/backend/approval_EPcard/approval_EPcard_wait.vue'

import approval_teachStatistics_pass from '../pages/backend/approval_teachStatistics/approval_teachStatistics_pass.vue'
import approval_teachStatistics_reject from '../pages/backend/approval_teachStatistics/approval_teachStatistics_reject.vue'
import approval_teachStatistics_wait from '../pages/backend/approval_teachStatistics/approval_teachStatistics_wait.vue'

import approval_a_resources_pass from '../pages/backend/approval_a/approval_a_resources_pass.vue'
import approval_a_resources_wait from '../pages/backend/approval_a/approval_a_resources_wait.vue'

import approval_a_EPcard_pass from '../pages/backend/approval_a/approval_a_EPcard_pass.vue'
import approval_a_EPcard_wait from '../pages/backend/approval_a/approval_a_EPcard_wait.vue'

import approval_a_teachStatistics_pass from '../pages/backend/approval_a/approval_a_teachStatistics_pass.vue'
import approval_a_teachStatistics_wait from '../pages/backend/approval_a/approval_a_teachStatistics_wait.vue'


//测试
import AAA2 from '../components/test/AAA2.vue'
import Login from '../components/test/Login.vue'
import Test from '../components/test/Test.vue'

//导入字体图标
import '../plugins/element.js'
import {
  Message, Button,
  Form, FormItem, Container,
  Header, Aside, Main,
  Menu, Submenu, MenuItem, MenuItemGroup,
  Breadcrumb, BreadcrumbItem,
  Card,
  Row, Col,
  Table, TableColumn,
  Switch,
  Tooltip,
  Dialog,
  MessageBox,
  Pagination,
  carousel,
  carouselItem,
  cascader,
} from 'element-ui'
//导入全局样式图标
// import './assets/fonts'
Vue.use(Button)
Vue.use(Form)
Vue.use(FormItem)
Vue.use(Input)
Vue.use(Container)
Vue.use(VueRouter)
Vue.use(Header)
Vue.use(Aside)
Vue.use(Main)
Vue.use(Footer)
Vue.use(Menu)
Vue.use(Submenu)
Vue.use(MenuItem)
Vue.use(MenuItemGroup)
Vue.use(Breadcrumb)
Vue.use(BreadcrumbItem)
Vue.use(Card)
Vue.use(Row)
Vue.use(Col)
Vue.use(Table)
Vue.use(TableColumn)
Vue.use(Switch)
Vue.use(Tooltip)
Vue.use(Pagination)
Vue.use(Dialog)
Vue.use(cascader)
Vue.use(carousel)
Vue.use(carouselItem)


Vue.prototype.$message = Message
Vue.prototype.$confirm = MessageBox.confirm

const routes = [

]

const router = new VueRouter({
  routes: [
    // { path: '/', redirect: '/login' },
    { path: '/', redirect: '/a1/a2' },
    { path: '/test', component: Test },
    {
      path: '/hosthome',
      component: Hosthome,
      redirect: '/hosthome',
      children: [
        // { path: '/Homepage', component: Homepage },
        { path: '/Homenews', component: Homenews },
        { path: '/Homenews_detail', name: 'newsdetail', component: Homenews_detail },
        { path: '/Allannouncements_datail', name: 'noticesdetail', component: Allannouncements_datail },
        { path: '/Laboratoryintroduction_detail', name: 'labdetail', component: Laboratoryintroduction_detail },
        { path: '/Studentachievement_detail', name: 'stuachdetail', component: Studentachievement_detail },
        { path: '/centeroverview', component: Centeroverview },
        { path: '/teachingstaff', component: teachingstaff },
        { path: '/laboratoryintroduction', component: Laboratoryintroduction },
        { path: '/managementsystem', component: Managementsystem },
        { path: '/allannouncements', component: Allannouncements },
        { path: '/coursewareresources', component: coursewareresources },
        { path: '/softwareresources_detail',name: 'sodetail', component: Softwareresources_detail },
        { path: '/coursewareresources_detail',name: 'redetail', component: coursewareresources_detail },
        { path: '/softwareresources', component: Softwareresources },
        { path: '/teachingreform', component: Teachingreform },
        { path: '/teachingachievements', component: Teachingachievements },
        { path: '/Teachingachievements_detail', name: 'achdetail', component: Teachingachievements_detail },
        { path: '/studentachievement', component: Studentachievement },
        { path: '/PAT', component: PAT },
        { path: '/SQL', component: SQL },
        { path: '/AOA', component: AOA },
        { path: '/managedresource', component: Managedresource },
        { path: '/ftp', component: FTP },
        { path: '/applications', component: applications },
        { path: '/server', component: Server },
        { path: '/teachingoperationtable', component: TeachingOperationTable },
        { path: '/experimentalprojectcard', component: ExperimentalProjectCard },
        { path: '/formDownload', component: FormDownload },
        { path: '/coursescheduling', component: Coursescheduling },
        { path: '/devicemanagement', component: DeviceManagement },
        { path: '/devicemanagement_detail',name: 'devdetail', component: DeviceManagement_detail },

      ],
    },
    {
      path: '/login', component: Login,
    },
    { path: '/aaa2', component: AAA2 },
    {
      path: '/a1',
      // You could also have named views at the top
      component: home_host,
      children: [{
        path: 'a2',
        components: {
          default: home_login,
          // helper: home_png
          home_png: home_png,
          home_notice: home_notice,
          home_lab: home_lab,
          home_teachre: home_teachre,
          home_teachach: home_teachach,
          home_eais: home_eais,
          home_application: home_application,
          home_news: home_news,
          home_show: home_show,
          home_plat: home_plat,
        }
      }]
    },
    { path: '/home_login', component: home_login },
    { path: '/home_login', component: home_login },
    {
      path: '/home',
      // name: 'Home',
      component: Home,
      redirect: '/welcome',
      children: [
        { path: '/welcome', name: 'Home', component: Welcome },
        { path: '/users', component: Users },
        { path: '/notices', component: Notices },
        { path: '/device', component: Device },
        { path: '/news', component: News },
        { path: '/topics', component: Topic },
        { path: '/messages', component: Messages },
        { path: '/menus', component: Menus },
        { path: '/resources', component: Resource },
        { path: '/category', component: Category },
        { path: '/test2', component: Test2 },
        { path: '/attachment', component: Attachment },
        { path: '/bc_lab', component: bc_lab },
        { path: '/bc_centerview', component: bc_centerview },
        { path: '/bc_teastaff', component: bc_teastaff },
        { path: '/bc_manage', component: bc_manage },
        { path: '/bc_teareform', component: bc_teareform },
        { path: '/bc_teaach', component: bc_teaach },
        { path: '/bc_stuach', component: bc_stuach },
        { path: '/bc_cources', component: bc_cources },
        { path: '/bc_soft', component: bc_soft },
        { path: '/apply_resources_add', component: apply_resources_add },
        { path: '/apply_resources_edit', component: apply_resources_edit },
        { path: '/apply_resources_detail', component: apply_resources_detail },
        { path: '/apply_EPcard_detail', component: apply_EPcard_detail },
        { path: '/apply_teachStatistics_detail', component: apply_teachStatistics_detail },
        { path: '/approval_resources_pass', component: approval_resources_pass },
        { path: '/approval_resources_reject', component: approval_resources_reject },
        { path: '/approval_resources_wait', component: approval_resources_wait },
        { path: '/approval_EPcard_pass', component: approval_EPcard_pass },
        { path: '/approval_EPcard_reject', component: approval_EPcard_reject },
        { path: '/approval_EPcard_wait', component: approval_EPcard_wait },
        { path: '/approval_teachStatistics_pass', component: approval_teachStatistics_pass },
        { path: '/approval_teachStatistics_reject', component: approval_teachStatistics_reject },
        { path: '/approval_teachStatistics_wait', component: approval_teachStatistics_wait },

        { path: '/approval_a_resources_pass', component: approval_a_resources_pass },
        { path: '/approval_a_resources_wait', component: approval_a_resources_wait },
        { path: '/approval_a_EPcard_pass', component: approval_a_EPcard_pass },
        { path: '/approval_a_EPcard_wait', component: approval_a_EPcard_wait },
        { path: '/approval_a_teachStatistics_pass', component: approval_a_teachStatistics_pass },
        { path: '/approval_a_teachStatistics_wait', component: approval_a_teachStatistics_wait },

        { path: '/hotnews', component: Hotnews },
      ]
    },


  ]
})


// 解决导航栏或者底部导航tabBar中的vue-router在3.0版本以上频繁点击菜单报错的问题。
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

// router.beforeEach((to, from, next) => {
//   if (to.path === '/hosthome') return next();
//   const tokenStr = window.sessionStorage.getItem('token');
//   if (!tokenStr) return next('/hosthome');
//   next();
// })


const whiteList = ['homepage', 'news']


export default router


